//--------------------------------
//--------INTRODUCTION------------
//--------------------------------
void OnEnter()
{
		PlayMusic("06_amb.ogg", true, 0.5f, 0.5f, 0, true);
		SetPlayerRunSpeedMul(0.0f);
		SetPlayerMoveSpeedMul(0.0f);
		SetPlayerLookSpeedMul(0.03f);
		SetPlayerCrouching(true);
		SetPlayerCrouchDisabled(true);
		SetPlayerJumpDisabled(true);
		SetInventoryDisabled(true);
		StartPlayerLookAt("LookAtArea_1", 0.7, 0.7, "");
		FadeImageTrailTo( 3.0f, 1.0f);
		AddTimer("door1", 7.0f, "lookatdoor");
}

void lookatdoor(string &in asTimer)
{
	StartPlayerLookAt("LookAtArea_2", 1, 1, "");
	AddTimer("hittingdoor", 7.0f, "smash");
}


void smash(string &in asTimer)
{
	CreateParticleSystemAtEntity("", "particles/break/ps_break_wood.ps", "hittingarea", true);
	PlayGuiSound("break/break_wood2.ogg", 1);
	AddPropForce("castle_1", 0.0f, 40.0f, 0.0f, "");
	AddTimer("black", 0.2f, "blackout");
}

void blackout(string &in asTimer)
{
	StartPlayerLookAt("LookAtArea_3", 1, 1, "");
	FadeOut(2.0f);
	AddTimer("black", 5.0f, "blackin");
}

void blackin(string &in asTimer)
{
	StartPlayerLookAt("LookAtArea_4", 1, 1, "shock");
	FadeIn(2.0f);
}

void shock()
{
	GiveSanityDamage(10, true);
	AddTimer("black", 0.2f, "blackout2");
}

void blackout2(string &in asTimer)
{
	StartPlayerLookAt("LookAtArea_3", 1, 1, "");
	FadeOut(2.0f);
	AddTimer("black", 5.0f, "blackin2");
}

void blackin2(string &in asTimer)
{
	StartPlayerLookAt("LookAtArea_2", 1, 1, "");
	FadeIn(2.0f);
	AddTimer("black", 1.0f, "normal");
}

void normal(string &in asTimer)
{
	FadeImageTrailTo( 1.0f, 1.0f);
	AddTimer("black", 5.0f, "normal2");
}

void normal2(string &in asTimer)
{
	SetPlayerRunSpeedMul(1.0f);
	SetPlayerMoveSpeedMul(1.0f);
	SetPlayerLookSpeedMul(1.0f);
	SetPlayerCrouching(false);
	SetPlayerCrouchDisabled(false);
	SetPlayerJumpDisabled(false);
	SetInventoryDisabled(false);
	GiveSanityBoost();
	StopPlayerLookAt();
}

//-------INTRODUCTION END-----------
//----------------------------------


//DOOR--------------------------------------

void smash_1(string &in entity) 
{
	FadeOut(2.0f);
	AddTimer("hittingdoor", 2.3f, "sound");
	SetPlayerRunSpeedMul(0.0f);
	SetPlayerMoveSpeedMul(0.0f);
}

void sound(string &in asTimer)
{
	PlayGuiSound("break/break_wood2.ogg", 1);
	AddTimer("hittingdoor", 0.2f, "sound2");
	TeleportPlayer("TeleportArea_1");
}

void sound2(string &in asTimer)
{
	PlayGuiSound("scare/scare_steps_big5.ogg", 1);
	AddTimer("hittingdoor", 8.2f, "sound3");
	SetEntityActive("castle_3", false);
	SetEntityActive("castle_4", false);
}


void sound3(string &in asTimer)
{
	PlayGuiSound("break/break_wood4.ogg", 1);
	AddTimer("hittingdoor", 0.2f, "smash_end");
}

void smash_end(string &in asTimer) 
{
	FadeIn(2.0f);
	AddTimer("hittingdoor", 2.2f, "stoplooking");
}

//DOOR-END--------------------------------------